
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="xms">
    <meta name="author" content="Xms">
    <link rel="icon" href="/content/favicon.ico">

    <title></title>

    <!-- Bootstrap core CSS -->
    <link href="/content/css/bootstrap3.3.5/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="/content/css/font-awesome.min.css" rel="stylesheet">
    <link href="/content/css/common.css" rel="stylesheet">
    <link href="/content/js/jquery-toast/jquery.toast.min.css" rel="stylesheet">
    <link id="themeLink" href="/content/css/theme/default.css" rel="stylesheet" />
    <!-- Bootstrap core JavaScript ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="/content/js/jquery.min.js"></script>
    <script src="/content/js/bootstrap.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="/content/js/ie10-viewport-bug-workaround.js"></script>
    <script src="/content/js/jquery.bootstrap.min.js"></script>
    <script src="/content/js/json2.js"></script>
    <script src="/content/js/xms.utility.js"></script>
    <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.core.js"></script>
    <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.widget.js"></script>
    <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.mouse.js"></script>
    <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.draggable.js"></script>
    <script src="/content/js/jquery-toast/jquery.toast.min.js"></script>
    <script src="/content/js/xms.jquery.js"></script>
    <script src="/content/js/xms.web.js"></script>
    <script src="/content/js/common/pagecontext.js"></script>
    <script src="/content/js/commonlabels.js"></script>
    <script src="/api/user/usercontext"></script>
    <script>
    jQuery(function () {
        Xms.Web.Loading();
        if (typeof parent !== 'undefined') {
            if (parent != window) {//判断当前页面是否为子页面
                $('body').addClass('xms-subpage');
            }
        }
    });
    function changeTheme(body,themename) {
        $("#themeLink").attr('href', '/content/css/theme/' + themename+'.css');
    }
</script>
    <link href="/content/js/bootstrap-datetimepicker/jquery.datetimepicker.css" rel="stylesheet">
    <link href="/content/js/uploadify/uploadify.css" rel="stylesheet">
    <link href="/content/js/jquery-ui-1.10.3/themes/base/jquery.ui.all.css" rel="stylesheet">
    <script src="/content/js/common/filters.js"></script>
    <link href="/content/js/grid/pqgrid.dev.css" rel="stylesheet">
    <link href="/content/customize/layui/css/layui.css" rel="stylesheet">
    <style>
        .header > .table > thead > tr > th, .header > .table > thead > tr > td, .header > .table > tbody > tr > th, .header > .table > tbody > tr > td {
            border: none !important;
        }

        .footer > .table > thead > tr > th, .footer > .table > thead > tr > td, .footer > .table > tbody > tr > th, .footer > .table > tbody > tr > td {
            border: none !important;
        }

        .header .table {
            margin-bottom: 0 !important;
        }

        .header, .footer {
            margin: 5px 0;
            border: 1px #ccc solid;
            background: #f6f8fa;
            padding: 5px;
        }

        .section, .tab {
            margin: 5px 0;
            margin-bottom: 10px;
        }

        .section-title {
            color: #999;
            height: 22px;
            border-bottom: 1px #ccc solid;
            clear: both;
            margin: 12px 0 8px;
        }

        .section table th {
            background: #f1f3f5;
            padding: 2px;
        }

        .section table {
            /*margin: 5px 0;*/
            clear: both;
        }

        .section > table td {
            background: #fff;
            vertical-align: top;
        }

        .subgrid .table {
            margin: 0;
        }

        .header label, #xmsFormFooter label {
            white-space: nowrap;
        }
        #toolbar .btn{margin-right:3px;}
        /*.form-group label,*/
    </style>
    <style>
        body {
            padding-top: 0;
        }
    </style>
</head>

<body data-spy="scroll" data-target="#myScrollspy">
<div class="container-fluid" id="body">
    <div class="row">
        <div class="shadeBox" style="background-color:#000000; opacity:0.5;width:100%;position:absolute;z-index:10;display:none;"></div>
        <div class="col-md-12" id="main" style="margin-bottom:80px;">
            <div><br class="breadcrumb" /></div>
            <div id="content"></div>
            <div class="page-render-wrap">
                <!--main-->
                <div id="formNotify" class="alert hide">
                    <a href="#" class="close" data-dismiss="alert">
                        &times;
                    </a>
                    <span class="glyphicon glyphicon-info-sign"></span><strong>注意！</strong><span id="formNotifyLabel"></span>
                </div>
                <div id="form-section" class="form-section">
                    <div id="flow-process-toolbar" class="container-fluid margin-bottom hide" style="border:1px #eee solid; padding:3px;">
                        <button class="btn btn-info btn-sm" type="button" onclick="WorkFlowProcessing(Xms.Page.PageContext.EntityId, Xms.Page.PageContext.RecordId)"><span class="glyphicon glyphicon-ok"></span> 审批处理</button>
                        <button class="btn btn-info btn-sm" type="button" onclick="WorkFlowProcessDetail(Xms.Page.PageContext.EntityId, Xms.Page.PageContext.RecordId)"><span class="glyphicon glyphicon-th"></span> 审批详情</button>
                        <button class="btn btn-info btn-sm" type="button" onclick="WorkFlowCancel(Xms.Page.PageContext.EntityId, Xms.Page.PageContext.RecordId)"><span class="glyphicon glyphicon-remove"></span> 撤消审批</button>
                    </div>
                    <div id="flow-completed-toolbar" class="alert alert-success hide">
                        <a href="#" class="close" data-dismiss="alert">
                            ×
                        </a>
                        <span class="glyphicon glyphicon-info-sign"></span><strong>注意！</strong>
                        <strong id="flow-result-text"></strong>
                        <button class="btn btn-link btn-sm" type="button" onclick="WorkFlowProcessDetail(Xms.Page.PageContext.EntityId, Xms.Page.PageContext.RecordId)"><span class="glyphicon glyphicon-th"></span> 审批详情</button>
                    </div>
                    <form id="editForm" method="post" action="/xms/api/data/aggrootsave" data-jsonajax="true" data-formdata="true" data-hiddendata="data" class="form-horizontal xms-form-wrap" data-autoreset="false">
                        <input type="hidden" id="entityid" data-hiddendata="true" name="entityid" />
                        <input type="hidden" id="formid" data-hiddendata="true" name="formid" />
                        <input type="hidden" id="recordid" data-hiddendata="true" name="recordid" />
                        <input type="hidden" id="relationshipname" data-hiddendata="true" name="relationshipname" />
                        <input type="hidden" id="referencedrecordid" data-hiddendata="true" name="referencedrecordid" />
                        <input type="hidden" id="child" data-hiddendata="true" name="child" />
                        <input type="hidden" id="attributechanged" data-hiddendata="true" name="attributechanged" />

                        <div class="container-fluid margin-bottom clearfix hide" style="padding:3px;" id="toolbar">
                        </div>

                        <div class="pull-right btn-group pt-1 toolbar-right">
                            <a class="btn btn-default btn-xs createForm-refresh" href="javascript:location.reload()" title="刷新"><span class="glyphicon glyphicon-refresh"></span></a>
                            <a class="btn btn-default btn-xs createForm-openWin" target="_blank" data-href="" title="新窗口打开"><span class="glyphicon glyphicon-fullscreen"></span></a>
                            <a class="btn btn-default btn-xs form-design" href="javascript:;" target="_blank" title="配置表单"><span class="glyphicon glyphicon-cog"></span></a>
                        </div>
                    </form>
                    <div class="attach-section hide" id="attachSection" style="display:none;">
                        <ul>
                            <li><a href="javascript:;" class="subtools" data-type="attach"><em class="glyphicon glyphicon-hdd"></em> 附件</a></li>
                        </ul>
                    </div>
                </div>
                <!-- （Modal） -->
                <div class="modal fade" id="createModal" tabindex="-1" role="dialog"
                     aria-labelledby="createModalLabel" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal"
                                        aria-hidden="true">
                                    ×
                                </button>
                                <h4 class="modal-title" id="createModalLabel">
                                    <span class="glyphicon glyphicon-file"></span> 新建
                                </h4>
                            </div>
                            <div class="modal-body">
                            </div>
                        </div><!-- /.modal-content -->
                    </div><!-- /.modal-dialog -->
                </div><!-- /.modal -->

            </div>
            <nav class="navbar navbar-default navbar-fixed-bottom hide" role="navigation" id="body-footer">
                <div class="container">
                    <div class="navbar-form navbar-right" id="body-footer-content">
                    </div>
                </div>
            </nav>
        </div>
    </div>
</div>

<script src="/content/js/jquery.form.js"></script>
<script src="/content/js/jquery-validate/jquery.validate.min.js"></script>
<script src="/content/js/jquery-validate/localization/messages_zh.min.js"></script>
<script src="/content/js/jquery.dirtyforms.js"></script>
<script src="/content/js/ueditor/ueditor.config.js"></script>
<script src="/content/js/ueditor/ueditor.all.min.js"></script>
<script src="/content/js/ueditor/addcustomizebutton.js"></script>

<script src="/content/js/form.js"></script>
<script src="/content/js/jquery.tmpl.js"></script>
<script src="/content/js/xms.js"></script>
<script src="/content/js/fetch.js"></script>
<script src="/content/js/renderform.js"></script>
<script src="/content/js/calculation.js"></script>
<script src="/content/js/bootstrap-datetimepicker/jquery.datetimepicker.full.js"></script>
<script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.core.js"></script>
<script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.widget.js"></script>
<script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.button.js"></script>
<script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.mouse.js"></script>
<script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.autocomplete.js"></script>
<script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.draggable.js"></script>
<script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.droppable.js"></script>
<script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.resizable.js"></script>
<script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.position.js"></script>
<script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.effect.js"></script>
<script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.tooltip.js"></script>
<script src="/content/js/common/dirtychecker.js"></script>
<script src="/content/js/common/formular.js"></script>

<script src="/content/js/grid/pqgrid.dev.js"></script>
<script src="/content/js/grid/localize/pq-localize-zh.js"></script>
<script src="/content/js/cdatagrid.js"></script>
<script src="/content/js/pages/m.datagrid.js"></script>
<script src="/content/js/pages/entity.create.js"></script>

<script>
    $('.createForm-openWin').attr('data-href', location.href);
    $('.form-design').on('click', function(){
        Xms.Web.OpenWindow('/xms/customize/systemform/edit?id=' + Xms.Page.PageContext.FormId, '_blank');
    });
    var services = {
        getEvents: ORG_SERVERURL + "/api/webresource/getcontent/"
    }

    var getEvents = function (url,callback) {
        if(!_webresources){
            callback && callback();
            return;
        }
        url += _webresources;
        console.log('load webresources', url);
        $.getScript(url,function(res){
            console.log('js loaded');
            //事件
            if(_form.Events != null){
                $(_form.Events).each(function(i, n){
                    var event = n;
                    if(event.Name == 'onload'){
                        console.log(event.JsAction);
                        try{
                            var func = getFunction(event.JsAction);
                            if(func){
                                func.call(this);
                            }
                        }catch(e){}
                    }else if(event.Name == 'onsave'){
                        try{
                            var func = getFunction(event.JsAction);
                            if(func){
                                Xms.FormPrevSubmit.add(func);
                            }
                        }catch(e){}
                    }else{
                        if(event["Attribute"]){
                            var eventTarget = $("#"+event["Attribute"]);
                            if(eventTarget.length==0){eventTarget = $("input[name='"+event["Attribute"].toLowerCase()+"']");}
                            if(eventTarget.hasClass("haslookup")){
                                eventTarget = eventTarget.prev().find(".lookup");
                                if(event.Name.replace("on","")=="change"){
                                    if(eventTarget.length>0){
                                        var ischange = false;//防止重复触发事件
                                        eventTarget.on("lookup.triggerChange",function(e){
                                            if(ischange==true)return false;
                                            ischange = true;
                                            var func = getFunction(event.JsAction);
                                            setTimeout(function(){
                                                func && func(e,this);
                                                ischange = false;
                                            },200);
                                        });
                                        eventTarget.on("change",function(e){
                                            ischange = true;
                                            var func = getFunction(event.JsAction);
                                            setTimeout(function(){
                                                func && func(e,this);
                                                ischange = false;
                                            },200);
                                        });
                                    }
                                }else{
                                    if(eventTarget.length>0){
                                        eventTarget.on(event.Name.replace("on",""),function(e){
                                            var func = getFunction(event.JsAction);
                                            setTimeout(function(){
                                                func && func(e,this);
                                            },200);

                                        });
                                    }
                                }
                            }else{
                                var entityType = eventTarget.attr("data-controltype");
                                if(entityType=="state"){
                                    eventTarget = eventTarget.parent().find("input[name^=state]");
                                }else if(entityType=="picklist"){
                                    eventTarget = eventTarget.siblings("select");
                                }
                                eventTarget.on(event.Name.replace("on",""),function(e){
                                    var func = getFunction(event.JsAction);
                                    //console.log(func);
                                    func && func(e,this);
                                });
                            }

                        }
                    }

                });
                $('body').trigger('eventAllLoaded');
            }
        });
    }
</script>

<script>
    pageWrap_Create.init();

    function getRecordInfo(id, callback) {
        //if(!_record) return false;
        //var res = {
        //    id:_record[id],
        //    value:_record[id+"name"]
        //}
        callback && callback(_record);
    }

    function getIframeHeight() {
        if ($("#formIframeContent").length > 0) {
            var iframeH = $("#formIframeContent").contents().find("html").height();
            //console.log(iframeH);
            $("#formIframeContent").height(iframeH);
        }
    }
    function SetWinHeight(obj) {
        // var setIframeTimer = setInterval(function () {
        getIframeHeight()
        // }, 27);
    }
    function changeFormIframe($obj) {
        var $formIframe = $("#formIframeContent");
        var url = $obj.attr("data-href");
        $formIframe.attr("src", url).show();
        $(".body").hide();
    }

    var isFormDirty = false;
    var isBindUnload = false;
    var unbindText = LOC_MODIFIED_STATE_NOTIFY;
    function bindBeforeUnload() {
        isFormDirty = dirtyChecker.isDirty;
        if (isFormDirty == false) return false;
        if (isBindUnload == true) return false;
        isBindUnload = true;
        $(window).bind("beforeunload", function () {
            return unbindText;
        });
        isFormDirty = false;
    }
    function unBindBeforeUnload() {
        $(window).unbind("beforeunload");
        isFormDirty = false;
        isBindUnload = false;
    }

    //function checkFormDirty() {
    //    return false;
    //}

    var WindowPostMessage = function (a) {
        //console.log(a);
        Xms.Web.Event.publish(a);
    }
</script>

</body>
</html>